#include <iostream>
#include <signal.h>

//打印panding表
void PrintPanding(){
    //获取panding表
    sigset_t pandingset;
    sigpending(&pandingset);

    std::cout << "panding signals 1 ~ 31: ";
    for(int i = 1; i < 32; i++){
        std::cout << sigismember(&pandingset, i);
    }
    std::cout << std::endl;
}

int main(){
    sigset_t bset;
    sigemptyset(&bset);//初始化信号集
    
    //全部屏蔽
    for(int i = 1; i < 32; i++){
        sigaddset(&bset, i);
    }
    sigprocmask(SIG_BLOCK, &bset, nullptr);//进入阻塞表

    //发送信号前的panding表
    PrintPanding();

    //发送全部1~31号信号，除9与19
    for(int i = 1; i < 32; i++){
        if(i != 9 && i != 19) raise(i);
    }

    //发信号后的panding表
    PrintPanding();

    return 0;
}